﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;


//Tal
namespace InformationExtraction
{
    class NameProcess : ExtractorProcess
    {
        public override void Execute(Person person, Page page)
        {
            Regex reg = new Regex(@"(\w*/NNP )+");
            string fullName = Extractor.StripPos(reg.Match(page.Sentences[0].RawSentence).Value.Trim());
            string[] name = fullName.Split(' ');
            person.FirstName = name[0];
            person.LastName = name[name.Length - 1];
            string middleName = "";
            for(int i = 1; i < name.Length -1; i++)
                middleName += name[i] + " ";
            person.MiddleName = middleName.Trim();
        }
    }
}
